$roboto-font-path: "~roboto-fontface/fonts" !default;
@import "~roboto-fontface/css/roboto/sass/roboto-fontface";

@import "~@mdi/font/css/materialdesignicons.min.css";
@import "./common/styles";
@import "~bootstrap/scss/bootstrap";

@each $color, $value in $theme-colors {
    .btn-#{$color} {
        border-color: darken($value, 5%);
    }
}

html, body, #webapp {
    height: 100%;
}

.core-main-area {
    background-color: $background-color;
    width: 100%;
    height: 100%;
    min-width: 930px;
    display: flex;
    flex-flow: column;
}

.core-nav-bar {
    width: 100%;
    flex: none;
    background-color: $brand-primary;
    display: flex;

    .core-nav-section {
        display: inline-block;
        padding: 10px 10px 0 10px;
        height: 55px;
    }
}


.core-nav-bar {
    .core-nav-section {
        border-left: 1px solid $brand-primary-dark;

        .dropdown {
            display: inline-block;
        }

        .dropdown-menu {
            background-color: $brand-primary;

            .dropdown-item {
                color: white;
                padding-left: 24px;
            }
            .dropdown-item:hover, .dropdown-item:focus {
                background-color: $brand-primary-dark;
            }
        }
    }
}

.core-main-layout {
    display: flex;
    flex-flow: row;
    height: 100%;
    min-height: 0;

    > div:nth-child(1) {
        flex: 1;
        display: flex;
        flex-flow: column;
        min-width: 0;
        position: relative;
        padding-right: 3px;

        // main view
        > div:nth-child(1) {
            flex: 1;
            border-top: 1px solid gray;
            box-shadow: inset -0px 0px 6px 0px gray;
            overflow: hidden;
        }

        // horizontal splitter
        > div:nth-child(2) {}

        // log viewer
        > div:nth-child(3) {
            border-top: 1px solid gray;
            overflow: hidden;
            width: 100%;
        }

        // vertical splitter
        > div:nth-child(4) {
            position: absolute;
            right: 0;
            height: 100%;
        }
    }

    // side panel
    > div:nth-child(2) {
        box-shadow: inset 0px 5px 6px -5px gray;
        background-color: white;
        border-top: 1px solid gray;
        border-left: 1px solid gray;
        overflow-y: auto;
        height: 100%;
    }
}

.core-splitter {
    min-width: 3px;
    min-height: 3px;
    background-color: lightgray;
    transition: background-color 0.5s linear;
}

.core-splitter:hover {
    background-color: darken(lightgray, 30%);
}
.core-splitter.horizontal {
    cursor: row-resize;
}
.core-splitter.vertical {
    border-top: 1px solid gray;
    cursor: col-resize;
}

.core-serial-port-selector, .core-device-selector {
    .dropdown-toggle.btn {
        min-width: 143px;
        height: 34px;
    }
    .dropdown-toggle::after {
        margin-left: 12px;
    }
}

.core-serial-port-indicator, .core-device-port-indicator {
    display: inline-block;
    height: 11px;
    width: 11px;
    border-radius: 50%;
    border: 1px solid #645e5e;

    &.on {
        background-color: $brand-success;
    }
    &.off {
        background-color: #cfcfcf;
    }
    &.error {
        background-color: $brand-danger;
    }
}

.core-device-selector-item {
    padding-left: 5px;

    // board version
    > div:nth-child(1) > span {
        margin-left: 20px;
    }
}

ul.core-device-selector-item-details {
    font-size: 11px;
    padding-left: 25px;
    margin-bottom: 0;
}

.core-main-view, .core-side-panel {
    padding: 10px 15px;
}

.core-log-viewer {
    background-color: $background-color;

    .core-infinite-log {
        position: relative;
        overflow-x: scroll !important;
        background-color: white;
        height: 155px;

        > div {
            display: table;
            min-width: 100%;
        }
    }

    .core-log-entry {
        height: 20px;
        white-space: nowrap;
        background-color: white;
        display: table-row;
        min-width: 100%;

        .core-log-time, .core-log-message {
            display: table-cell;
            padding: 0 20px;
            border-right: 1px dotted gray;
            border-bottom: 1px dotted gray;
            height: 20px;
            line-height: 20px;
            user-select: text;
        }
        .core-log-time {
            width: 132px;
            min-width: 132px;
        }
    }

    .core-log-level-silly,
    .core-log-level-debug,
    .core-log-level-verbose,
    .core-log-level-info,
    .core-log-level-warn {
        background-color: white;
    }

    .core-log-level-error {
        color: $state-danger-text;
        background-color: $state-danger-bg;
    }

    .core-log-header {
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    .core-log-header-text {
        height: 30px;
        line-height: 30px;
        font-weight: bold;
        padding-left: 20px;
        font-size: 14px;
        margin:0;
        flex: 1;
    }

    .core-log-header-buttons {
        align-content: flex-end;
        padding: 6px 6px 6px 0px;
    }
}

#main-menu.dropdown {
    .dropdown-toggle::after {
        display: none;
    }
}
